﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace WFCSharp_I
{
    public partial class OrderFood : Form
    {
        public OrderFood()
        {
            InitializeComponent();
        }

        private void OrderFood_Load(object sender, EventArgs e)
        {
            menuTreeView.ExpandAll();
            foodDomain.SelectedIndex = 0;
        }

        private void menuTreeView_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e)
        {
            if (e.Node.Tag != null)
            {
                ListViewItem item = new
                    ListViewItem(e.Node.Text, int.Parse(e.Node.Tag.ToString()));

                item.SubItems.Add(e.Node.Tag.ToString());
                choiceListView.Items.Add(item);
            }
        }

        private void radioButton1_CheckedChanged(object sender, EventArgs e)
        {
            choiceListView.View = View.LargeIcon;
        }

        private void radioButton2_CheckedChanged(object sender, EventArgs e)
        {
            choiceListView.View = View.SmallIcon;
        }

        private void radioButton3_CheckedChanged(object sender, EventArgs e)
        {
            choiceListView.View = View.Tile;
        }

        private void radioButton4_CheckedChanged(object sender, EventArgs e)
        {
            choiceListView.View = View.List;
        }

        private void radioButton5_CheckedChanged(object sender, EventArgs e)
        {
            choiceListView.View = View.Details;
        }

        private void addButton_Click(object sender, EventArgs e)
        {
            TreeNode node = new TreeNode(foodDomain.SelectedItem.ToString());
            menuTreeView.SelectedNode.Nodes.Add(node);
        }

        private void deleteButton_Click(object sender, EventArgs e)
        {
            menuTreeView.SelectedNode.Remove();
        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            progressBar1.PerformStep();

            if (progressBar1.Value == progressBar1.Maximum)
            {
                timer1.Stop();
                progressBar1.Visible = false;
                progressBar1.Value = 0;
                //timer1.Enabled = false;
            }
        }

        private void button1_Click(object sender, EventArgs e)
        {
            progressBar1.Visible = true;
            timer1.Start();
            //timer1.Enabled = true;
        }
    }
}
